package com.sky.context;

/**
 * 当前线程中的基础数据
 */
public class BaseContext {

    public static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    /**
     * 设置存储当前线程中登录的用户id
     * @param id
     */
    public static void setCurrentId(Long id) {
        threadLocal.set(id);
    }

    /**
     * 获取当前请求中登录的用户id
     * @return
     */
    public static Long getCurrentId() {
        return threadLocal.get();
    }

    /**
     * 一处当前线程中的用户id
     */
    public static void removeCurrentId() {
        threadLocal.remove();
    }

}
